//
//  YKClientVisitItemCell.m
//  YunKang
//
//  Created by leoking870 on 2017/10/14.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKClientVisitItemCell.h"
#import "YKDashView.h"
@interface YKClientVisitItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *clientNoLabel;
@property (weak, nonatomic) IBOutlet UILabel *clientNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *clientDateLabel;
@property (weak, nonatomic) IBOutlet UILabel *businessmanLabel;
@end


@implementation YKClientVisitItemCell
@dynamic tableViewItem;
- (void)cellLoadSubViews {
    [super cellLoadSubViews];
    
    self.clientNoLabel.tf_weight = 1;
    self.clientDateLabel.tf_weight = 1;
    self.clientNameLabel.tf_weight = 1;
    self.businessmanLabel.tf_weight = 1;
    
    self.clientNoLabel.textAlignment = NSTextAlignmentCenter;
    self.clientDateLabel.textAlignment = NSTextAlignmentCenter;
    self.clientNameLabel.textAlignment = NSTextAlignmentCenter;
    self.businessmanLabel.textAlignment = NSTextAlignmentCenter;
    
    [@[self.clientNoLabel, self.clientNameLabel,self.businessmanLabel, self.clientDateLabel] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.top.equalTo(self.contentView.mas_top).offset(11);
    }];
    
    [@[self.clientNoLabel, self.clientNameLabel,self.businessmanLabel, self.clientDateLabel] mas_alignWeightlyAlongAxis:MASAxisTypeHorizontal
                                                                                       fixedSpace:@4
                                                                                        leadingTo:self.contentView.mas_leading
                                                                                        leadSpace:13
                                                                                       trailingTo:self.contentView.mas_trailing
                                                                                        tailSpace:13];
    
    YKDashView* dashView = [[YKDashView alloc]init];
    dashView.lineWidth = .5f;
    dashView.lineColor = [UIColor tf_colorWithHexString:@"#d4d4d4"];
    dashView.dashLineLength = 3;
    [self addSubview:dashView];
    [dashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self);
        make.height.mas_equalTo(1);
    }];
    
}

- (void)cellWillAppear {
    [super cellWillAppear];
    self.clientDateLabel.text = [[self.tableViewItem.model.VISITDATE componentsSeparatedByString:@" "]firstObject];
    self.clientNameLabel.text = self.tableViewItem.model.C_NAME;
    self.clientNoLabel.text = self.tableViewItem.model.VISITNO;
    self.businessmanLabel.text = self.tableViewItem.model.OPERATOR;
}

@end
